package com.songlanyun.modules.skus.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.songlanyun.common.drive.IBaseService;
import com.songlanyun.common.supplychainapi.goods.model.GoodsDetailResult;
import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.modules.goods.model.values.SkuItem;
import com.songlanyun.modules.group.entity.ProductGoodsGroupEntity;
import com.songlanyun.modules.skus.entity.ProductSkusEntity;

import java.util.List;
import java.util.Map;

/**
 * 商家的商品规格表，创建了之后，对于已有的规格，在发布商品时只需要选择
 *
 * @author lubo
 * @email sunlightcs@gmail.com
 * @date 2020-11-03 15:46:49
 */
public interface ProductSkusService extends IBaseService<Long, ProductSkusEntity> {

    List<Map<String,Object>> getAllSku(Long shopId);
    List<ProductSkusEntity> getChildren(Long shopId, Long parentId);
    List<ProductSkusEntity> selectByIds(Long shopId,Long[] ids);

    List<ProductSkusEntity> getTopSku(Long shopId);
    ProductSkusEntity getByShopIdAndId(Long shopId,Long id);

    ProductSkusEntity add(Long shopId,ProductSkusEntity entity);
    ProductSkusEntity update(Long shopId,ProductSkusEntity entity);
    void deleteByShopIdAndId(Long shopId,Long id);

    SkuItem getOrCreate(Long shopId, GoodsDetailResult.Name name, Long parentId);
    SkuItem getOrCreate(Long shopId, GoodsDetailResult.Value value, Long parentId);
}

